Skip to main content

Commands for Reading a file in Linux

 

Command

Description

ls

Directory listing

cat filename

View file content

less

View file page by page

Ex: less <filename>

It will display a page. If we enter space we will get another page

If we want to exit please click Q or q on your keyboard

page

Display file page by page (Ubuntu flavor)

more

Output the contents of the file

Ex: more filename

head

Output the required number of lines from top to bottom in a file

Ex: head -5 filename

tail

Output the required number of lines from bottom to top in a file

Ex: tail -5 filename

 

Comments